package com.zhaojindong.ioc.component.register.second;

import lombok.extern.log4j.Log4j;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@Log4j
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(classes = SecondConfig.class)
public class SecondTest {

    /**
     * dependency inject best practice, instead of attribute
     * of course you can use construct or any method, more than set method
     */

//    private EgController egController;
//
//    @Autowired
//    public void setEgController(EgController egController) {
//        this.egController = egController;
//    }

    @Test
    public void TestMethod() {
//        Assert.assertNotNull(egController);
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SecondConfig.class);
        String[] beanDefinitionNames = context.getBeanDefinitionNames();
        for (String name : beanDefinitionNames) {
            log.info(name);
        }


    }
}
